<?php 
echo "<div id='searchBar'>";
echo $this->Form->create('posts', array('type'=>'get', 'action'=>'search')); 
                        
                         echo $form->input('search', array('label'=>'','onkeyup'=> 'preclude(this)',  'onkeypress'=>"if (event.keyCode==13){ return searching()}", 'value'=>$search2, 'id'=> 'search', 'type'=>'textarea'));   
                         echo $form->submit('Search', array('id'=>'search1', 'onclick'=>'return disablelets()'));
                         echo "<span class='push'>Advanced<br/> Options?";
                         if (isset($advanced)) {
                          echo '<input type="checkbox" onclick="return advanced1(this)" name="advanced" value="1" id="postsAdvanced" checked="yes"></span>';
                          echo "<div class='searchBox'>";
                          }
                         else {
                              echo '<input type="checkbox" onclick="return advanced1(this)" name="advanced" value="1" id="postsAdvanced"></span>';
                             echo "<div class='searchBox' style='display:none'>";
                             }
                        echo "<span class='searchLabel'>Sort By:</span><div>";

//                        echo $sort;
                           echo $form->select('sort',array('created'=>'Recently Modified','up'=>'Top', 'replies'=>'Number of replies'), $sort, array('empty'=>false, 'escape' => false));
                          

                        echo "</div><span class='searchLabel'>View as:</span><div>";
                        $attributes=array();
                        $attributes['legend']=false;
                        $attributes['default']=$viewas;
                           echo $this->Form->radio('viewas', array('Relaxed', 'Table'), $attributes);
                          
                        echo "</div><span class='searchLabel'>Disinclude tags:</span>";
                           echo $form->input('disinclude', array('label'=>'', 'type'=>'textarea', 'onkeypress'=>"if (event.keyCode==13){ return  false}", 'onkeyup'=> 'preclude1(this, "-")'));
                           

                        echo "<span class='searchLabel'>Have any of these tags:</span>";
                           echo $form->input('any', array('label'=>'','type'=>'textarea', 'onkeypress'=>"if (event.keyCode==13){ return false}", 'onkeyup'=> 'preclude1(this, "+")'));
                          
                           
                           echo "<span class='searchLabel'>Include:</span><div style='line-height:5px;'>";
                           echo $this->Form->checkbox('p', array('checked'=>$p, 'hiddenField'=>false, 'label'=>'hi'))." Posts  ";
                           echo $this->Form->checkbox('c', array('checked'=>$c, 'hiddenField'=>false))." Comments  ";
                           echo $this->Form->checkbox('i', array('checked'=>$i, 'hiddenField'=>false))." Images  ";
                            echo "</div></div>";
                            
                            
                            
						 echo "</div>";

echo $this->Form->end();
?>